A=[0.8 -0.2 -0.3 -0.3; -0.35 0.9 -0.35 -0.2; -0.1 -0.2 0.5 -0.2; -0.2 -0.3 -0.2 0.7]
A(1,:)=A(1,:)/A(1,1);
A(2,:)=A(2,:)-A(2,1)/A(1,1)*A(1,:);
A(3,:)=A(3,:)-A(3,1)/A(1,1)*A(1,:);
A(4,:)=A(4,:)-A(4,1)/A(1,1)*A(1,:);

A(2,:)=A(2,:)/A(2,2);
A(1,:)=A(1,:)-A(1,2)/A(2,2)*A(2,:);
A(3,:)=A(3,:)-A(3,2)/A(2,2)*A(2,:);
A(4,:)=A(4,:)-A(4,2)/A(2,2)*A(2,:);

A(3,:)=A(3,:)/A(3,3);
A(1,:)=A(1,:)-A(1,3)/A(3,3)*A(3,:);
A(2,:)=A(2,:)-A(2,3)/A(3,3)*A(3,:);
A(4,:)=A(4,:)-A(4,3)/A(3,3)*A(3,:);

A

A=[0.8 -0.1 -0.4 -0.3; -0.35 0.9 -0.35 -0.2; -0.1 -0.2 0.5 -0.2; -0.2 -0.3 -0.2 0.7]
A(1,:)=A(1,:)/A(1,1)
A(2,:)=A(2,:)-A(2,1)/A(1,1)*A(1,:)
A(3,:)=A(3,:)-A(3,1)/A(1,1)*A(1,:)
A(4,:)=A(4,:)-A(4,1)/A(1,1)*A(1,:)

A(2,:)=A(2,:)/A(2,2)
A(1,:)=A(1,:)-A(1,2)/A(2,2)*A(2,:)
A(3,:)=A(3,:)-A(3,2)/A(2,2)*A(2,:)
A(4,:)=A(4,:)-A(4,2)/A(2,2)*A(2,:)

A(3,:)=A(3,:)/A(3,3)
A(1,:)=A(1,:)-A(1,3)/A(3,3)*A(3,:)
A(2,:)=A(2,:)-A(2,3)/A(3,3)*A(3,:)
A(4,:)=A(4,:)-A(4,3)/A(3,3)*A(3,:)

A
